<html>
<head><meta charset="utf-8"><title>A dump format for seeing async structs? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html">A dump format for seeing async structs?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="231429585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231429585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231429585">(Mar 23 2021 at 07:07)</a>:</h4>
<p>Do we have a dump format for seeing fields/captures of async structs/closures? None of HIR or MIR dumps make these clear as far as I can see.</p>
<p>Ideally I'd like to see async/await completely desugared, in a Rust-like syntax. Is this possible?</p>



<a name="231468590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231468590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231468590">(Mar 23 2021 at 13:21)</a>:</h4>
<p>I remember seeing #[rustc_capture_analysis] at some point but I haven't been able to find documentation for it.</p>



<a name="231478865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231478865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231478865">(Mar 23 2021 at 14:27)</a>:</h4>
<p>I wonder how much info is exposed by <code>-Zprint-type-sizes</code> here...</p>



<a name="231479446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231479446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231479446">(Mar 23 2021 at 14:31)</a>:</h4>
<p>There is also <code>[rustc_layout(debug)]</code>, which may include more detail than what you are looking for. See <a href="https://www.ralfj.de/blog/2020/04/04/layout-debugging.html">RalfJ's blog post</a></p>



<a name="231881453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231881453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231881453">(Mar 25 2021 at 21:47)</a>:</h4>
<p>I would have guessed <code>-Zmiri-track-raw-pointer</code> though you've specified a lot of requirements that I'm not sure can be handled by that flag alone</p>



<a name="231925599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231925599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231925599">(Mar 26 2021 at 07:43)</a>:</h4>
<p>The "in a Rust-like syntax" part is not a requirement. As long as I see what variables are captured it's fine. I looked at <code>rustc_layout(debug)</code> but I didn't try it on <code>async fns</code> yet, I'll see if that works. I'll also try <code>-Zmiri-track-raw-pointer</code> today.</p>



<a name="231933136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231933136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231933136">(Mar 26 2021 at 09:05)</a>:</h4>
<p>Just tried <code>rustc_layout(debug)</code> on an async fn but unfortunately it's not used when attached to a function. I get <code>unused attribute</code> warning.</p>



<a name="231984567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231984567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231984567">(Mar 26 2021 at 15:31)</a>:</h4>
<p><span class="user-mention" data-user-id="119169">@osa1</span> yeah you need to use a little trick to get your hands on the retrun type</p>



<a name="231984595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231984595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231984595">(Mar 26 2021 at 15:31)</a>:</h4>
<p>its at the end of the blog post</p>



<a name="231984646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231984646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231984646">(Mar 26 2021 at 15:31)</a>:</h4>
<p>see <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=de99ab78a4d77bceee6760021b19de7d">this playpen</a></p>



<a name="231985070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231985070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231985070">(Mar 26 2021 at 15:33)</a>:</h4>
<p>(with the new renamed gate <code>min_type_alias_impl_trait</code>)</p>



<a name="231985614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/A%20dump%20format%20for%20seeing%20async%20structs%3F/near/231985614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/A.20dump.20format.20for.20seeing.20async.20structs.3F.html#231985614">(Mar 26 2021 at 15:36)</a>:</h4>
<p>(also, I’m not so sure the output format of <code>rustc_layout(debug)</code> is … really the best for end users ...</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>